//
// Created by wxd on 2025/9/11.
//

#pragma once

#ifndef MESH_H
#define MESH_H

#include "IMesh.h"
#include "../glFramework/demo/obj/Object.h"

class Mesh : public IMesh, public Object {
public:
    Mesh(): Object(ObjectType::MESH) {
    }

    explicit Mesh(const std::string& name) : Object(ObjectType::MESH), mMeshName(name) {
    }

    Mesh(const MeshType type, const std::string& name) : Object(ObjectType::MESH), mType(type), mMeshName(name) {}

    std::string getName() const override { return mMeshName; }
    std::string getTraceId() const override { return mTraceId; }
    MeshType getType() const override { return mType; }

    void setGeometry(std::unique_ptr<BaseGeometry> geo) override { mGeometry = std::move(geo); }
    void setMaterial(std::unique_ptr<Material> material) override { mMaterial = std::move(material); }

    BaseGeometry* getGeometry() const {
        return mGeometry.get();
    }

    Material* getMaterial() const {
        return mMaterial.get();
    }

    void setMeshName(const std::string& name) {
        mMeshName = name;
    }

    void setTraceId(const std::string& id) {
        mTraceId = id;
    }

    void setType(const MeshType type) {
        mType = type;
    }

protected:
    std::string mMeshName { "Mesh" };
    std::string mTraceId;
    MeshType mType { MeshType::NONE };

    std::unique_ptr<BaseGeometry> mGeometry {};
    std::unique_ptr<Material> mMaterial {};
};



#endif //MESH_H
